<template>
  <div class="item-buy-succ-page">
    <div class="container">
      <div class="head-img">
        <img :src="userInfo.avatar" class="headerImg">
      </div>
      <div class="sign">购买成功啦！</div>
      <div class="btn-group">
        <div class="succ-btn">购买成功</div>
        <div class="check-btn" @click="routerLink(`home`)">返回首页</div>
      </div>
    </div>
  </div>
</template>

<script>
// api
import { userInfo } from '@/api/miva'
export default {
  data() {
    return {
      show: false,
      userInfo: {}
    }
  },
  async mounted() {
    await this.getUserInfo()
  },
  methods: {
    // 获取用户信息
    async getUserInfo() {
      const res = await userInfo() || {}
      this.userInfo = res.data || {}
    },
    routerLink(name) {
      this.$router.replace({ name })
    }
  }
}
</script>

<style lang="less">
.item-buy-succ-page {
  width: 100%;
  height: 87vh;
  padding: 3vw 4vw 1vw;
  background: #f5f6f8;
  box-sizing: border-box;
  .container {
    width: 100%;

    background: #fff;
    padding: 10px 0;
    box-sizing: border-box;
    border-radius: 6px;
    margin-bottom: 10px;
    .head-img {
      position: relative;
      height: 30vw;

      .headerImg {
        width: 100px;
        height: 100px;
        overflow: hidden;
        padding: 10px;
        position: absolute;
        transform: translate(-50%, -50%);
        top: 50%;
        left: 50%;
        border-radius: 50%;
        img {
          width: 100%;
          border-radius: 50%;
        }
      }
    }
    .sign {
      text-align: center;
      padding: 15px 0;
      font-size: 14px;
    }
    .btn-group {
      width: 50%;
      margin: 0 auto;
      text-align: center;
      color: #fff;
      font-size: 14px;
      .succ-btn {
        background: #f9c023;
        padding: 15px 10px;
        margin-bottom: 10px;
        border-radius: 10px;
      }
      .check-btn {
        background: #d63a54;
        padding: 15px 10px;
        border-radius: 10px;
      }
    }
  }
}
</style>
